package com.xiaoyu.lanling.feature.chat.viewholder

import `in`.srain.cube.views.list.CubeRecyclerViewAdapter
import com.xiaoyu.lanling.feature.chat.model.message.ChatMessageBaseItem

object ChatViewHolderManager {

    const val TYPE_UNKNOWN = 0
    const val TYPE_SYSTEM = 1
    const val TYPE_TIME = 100

    const val TYPE_SEND_TEXT = 1001
    const val TYPE_SEND_IMAGE = 1003
    const val TYPE_SEND_AUDIO = 1005
    const val TYPE_SEND_GIFT = 1007
    const val TYPE_SEND_CALL = 1009
    const val TYPE_SEND_VIDEO = 1011

    const val TYPE_RECEIVE_TEXT = 1002
    const val TYPE_RECEIVE_IMAGE = 1004
    const val TYPE_RECEIVE_AUDIO = 1006
    const val TYPE_RECEIVE_GIFT = 1008
    const val TYPE_RECEIVE_CALL = 1010
    const val TYPE_RECEIVE_VIDEO = 1012

    fun bindViewHolder(adapter: CubeRecyclerViewAdapter<ChatMessageBaseItem>) {
        adapter.setViewHolderClass(TYPE_UNKNOWN, null, ChatMessageUnknownViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_SYSTEM, null, ChatMessageSystemViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_TIME, null, ChatMessageTimeViewHolder::class.java, 20)

        adapter.setViewHolderClass(TYPE_SEND_TEXT, null, ChatMessageSendTextViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_SEND_IMAGE, null, ChatMessageSendImageViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_SEND_AUDIO, null, ChatMessageSendAudioViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_SEND_VIDEO, null, ChatMessageSendVideoViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_SEND_GIFT, null, ChatMessageSendGiftViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_SEND_CALL, null, ChatMessageSendCallViewHolder::class.java, 20)

        adapter.setViewHolderClass(TYPE_RECEIVE_TEXT, null, ChatMessageReceiveTextViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_RECEIVE_IMAGE, null, ChatMessageReceiveImageViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_RECEIVE_AUDIO, null, ChatMessageReceiveAudioViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_RECEIVE_VIDEO, null, ChatMessageReceiveVideoViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_RECEIVE_GIFT, null, ChatMessageReceiveGiftViewHolder::class.java, 20)
        adapter.setViewHolderClass(TYPE_RECEIVE_CALL, null, ChatMessageReceiveCallViewHolder::class.java, 20)
    }
}